import request from '@/utils/request'

// //忘记密码
export function forgotPassword(data: Record<string, any>) {
    return request.post({ url: '/user/resetPassword', data })
}

export function getUserCenter(header?: any, data?: any) {
    return request.get({ url: '/user/center', data, header })
}

// 个人信息
export function getUserInfo(data: any) {
    return request.get({ url: '/user/info', data }, { isAuth: true })
}

// 个人编辑
export function userEdit(data: any) {
    return request.post({ url: '/user/edit', data }, { isAuth: true })
}

// 绑定手机
export function userBindMobile(data: any, header?: any) {
    return request.post({ url: '/user/bindMobile', data, header }, { isAuth: true })
}

// 微信电话
export function userMnpMobile(data: any) {
    return request.post({ url: '/user/mnpMobile', data }, { isAuth: true })
}
export function userChangePwd(data: any) {
    return request.post({ url: '/user/changePwd', data }, { isAuth: true })
}

/**
 * @description 发送验证码-绑定手机号
 */
export const apiBindMobileCaptcha = (data: any, header?: any) =>
    request.post({ url: '/user/bindMobileCaptcha', data, header })

/**
 * @description 绑定手机号
 */
export const apiBindMobile = (params: any) =>
    request.post({ url: '/user/bindMobile', data: params })

/**
 * @description 获取我的收藏列表
 */
export const apiCollectLists = (params: any) =>
    request.get({ url: '/course/mine/favorites', data: params })

/**
 * @description 课程收藏
 */
export const apiCourseCollection = (params: any) =>
    request.post({ url: '/course/collect/switch', data: params })
/** Collect End **/

/** Evaluate Start **/
/**
 * @description 获取我的评价列表
 */
export const apiEvaluateLists = (params?: any) =>
    request.get({ url: '/course/mine/commentList', data: params })

/** Evaluate Start **/
/**
 * @description 获取评论列表个数
 */
export const apiCommentCount = () => request.get({ url: '/course/mine/comment/count' })

/**
 * @description 评价课程信息
 */
export const apiEvaluateGoodsInfo = (params: any) =>
    request.get({ url: '/course/detail', data: params })

/**
 * @description 提交评价信息
 */
export const apiEvaluateAdd = (params: any) =>
    request.post({ url: '/course/comment/add', data: params })
/** Evaluate End **/

/** Wallet Start **/
/**
 * @return { Promise }
 * @description 我的钱包
 */
export const apiUserWallet = () => request.get({ url: '/user/wallet' }, { isAuth: true })

/**
 * @return { Promise }
 * @description 账户流水
 */
export const apiAccountLogLists = (params: any) =>
    request.get({ url: '/user/accountLogs', data: params }, { ignoreCancel: true })
/** Wallet End **/

/** Charge Start **/
/**
 * @return { Promise }
 * @description 充值模版
 */
export const apiChargeTemplateLists = () => request.get({ url: '/recharge/templateLists' })

/**
 * @description 充值金额
 */
export const apiChargeMoney = (params: any) =>
    request.post({ url: '/recharge0rder/add', data: params })

/**
 * @return { Promise }
 * @description 充值记录
 */
export const apiChargeLogLists = (params: any) =>
    request.get({ url: '/recharge0rder/list', data: params })
/** Charge End **/

//更新微信小程序头像昵称
export function updateUser(data: Record<string, any>, header: any) {
    return request.post({ url: '/user/updateUser', data, header })
}
